import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginVue from 'eslint-plugin-vue';

/** @type {import('eslint').Linter.Config[]} */
export default [
	{
		files: ['**/*.{js,mjs,cjs,ts,vue}'],
		// 添加需要忽略的文件
		ignores: [
			'dist/**',
			'node_modules/**',
			'*.min.*',
			'*.md',
			'.vscode',
			'.idea',
			'/public',
			'/docs',
			'.husky',
			'.local',
			'/bin'
		]
	},
	{ languageOptions: { globals: globals.browser } },
	pluginJs.configs.recommended,
	...tseslint.configs.recommended,
	...pluginVue.configs['flat/essential'],
	{ files: ['**/*.vue'], languageOptions: { parserOptions: { parser: tseslint.parser } } },
	{
		rules: {
			// TypeScript 规则
			'@typescript-eslint/no-explicit-any': 'off',
			'@typescript-eslint/no-unsafe-function-type': 'off',
			'@typescript-eslint/explicit-function-return-type': 'off',
			'vue/no-unused-components': 'off',
			'space-before-function-paren': 0,
			'eslint-disable-next-line': 'off',
			'eslint-disable': 'off',
			'vue/multi-word-component-names': 'off', // 禁用规则
			'vue/require-default-prop': 'off', // 禁用props传递值必须有默认值
			'vue/v-on-event-hyphenation': 'off' // 禁用事件名称必须为连字符
		}
	}
];
